package rulusoft.nook.rssReader;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import rulusoft.nook.rssReader.core;

public class loginActivity extends Activity {

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
                
        setContentView(R.layout.login);
        
        loginbtn=(Button)findViewById(R.id.loginbtn);
        logintxt=(EditText)findViewById(R.id.logintxt);
        passtxt=(EditText)findViewById(R.id.passtxt);
        txtview=(TextView)findViewById(R.id.textview);
        
        connect=new core();
        
        loginbtn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//String login=logintxt.getText().toString();
				//String password=passtxt.getText().toString();
				String login="rasulnz@gmail.com";
				String password="zwing7nj";
				auth=connect.getGoogleAuthKey(login, password);
				//connect.Connect();
				if(auth != "error") {
					logintxt.setVisibility(View.INVISIBLE);
					passtxt.setVisibility(View.INVISIBLE);
					loginbtn.setText("Loaded!");
					loginbtn.setEnabled(false);
					txtview.setText(auth);
					connect.setAuthSatic(auth);
					finish();
				}
				else
					txtview.setText("error");
				
			}
		});  
    }
    private static String auth;
    Button loginbtn;
    EditText logintxt;
    EditText passtxt;
    TextView txtview;
    Button subscButn;
    public core connect;
}
